﻿using MediatR;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using MyMES.Error;
using MyMES.Read.API.Application.Commends.Enterprises;
using MyMES.Read.API.Dtos;

namespace MyMES.Read.API.Controllers.ZMC.Enterprises
{
    /// <summary>
    /// 企业信息
    /// </summary>
    [Route("api/[controller]/[action]")]
    [ApiController]
    public class EnterprisesController : ControllerBase
    {
        private readonly IMediator mediator;

        public EnterprisesController(IMediator mediator)
        {
            this.mediator = mediator;
        }



        /// <summary>
        /// 获取企业信息
        /// </summary>
        /// <param name="request"></param>
        /// <param name="cancellationToken"></param>
        /// <returns></returns>
        /// <exception cref="NotImplementedException"></exception>
        /// 
        [HttpGet]
        public async Task<APIResult<List<EnterDepDto>>> GetEnterprise([FromQuery] GetEnterpriseCommends request, CancellationToken cancellationToken)
        {
            return await mediator.Send(request, cancellationToken);
        }
    }
}
